#!/user/bin/env python
# -*- coding: utf-8 -*-
print "hello";

#def f(x):
#    return x*x


# 仿map()函数
def my_map(f,l=None):
    nl = []
    for x in l:
        nl.append(f(x))
    print nl

#my_map(f,[1,2,3])

import functools

def log(text):
    if isinstance(text,str):
        def decorator(func):
            @functools.wraps(func)
            def wrapper(*args,**kw):
#               print 'begin call'
#               print type(text)
                print '%s %s():' % (text,func.__name__)
#               print 'end call'
                return func(*args,**kw)
            return wrapper
        return decorator
    else:
        @functools.wraps(text)
        def wrapper(*args,**kw):
            print 'call %s():' % text.__name__
            return text(*args,**kw)
        return wrapper

@log
def f():
    pass

@log('123')
def f2():
    pass

f()
f2()
